package handler

import (
	// "encoding/json"
	// "fmt"
	// "io/ioutil"
	"net/http"

	"bigmodel/internal/logic"
	"bigmodel/internal/svc"
	"bigmodel/internal/types"

	"github.com/zeromicro/go-zero/rest/httpx"
)

func BigmodelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		query := r.URL.Query()
		req := &types.Request{
			Platform: query["platform"][0],
			Content: query["content"][0],
			Model: query["model"][0],
			Stream: query["stream"][0],
		}
		l := logic.NewBigmodelLogic(r.Context(), svcCtx)
		resp, err := l.Bigmodel(req,w)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
